﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;
using TCC_Hotel.Serviços.BDServices;

namespace TCC_Hotel.Apresentacao.Login
{
    public partial class Login : System.Web.UI.Page
    {
        LoginService servico = new LoginService();

        /// <summary>
        /// Carregamento da página
        /// </summary>
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        /// <summary>
        /// Evento que cuida da parte de login no sistema
        /// </summary>
        protected void LoginSistema_Authenticate(object sender, AuthenticateEventArgs e)
        {
            if (servico.VerificarLogin(LoginSistema.UserName, LoginSistema.Password))
            {
                e.Authenticated = true;
                FormsAuthentication.RedirectFromLoginPage(LoginSistema.UserName, false);
            }
            else
            {
                e.Authenticated = false;
            }
        }
    }
}